/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.persistencia.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.Size;

/**
 *
 * @author kenny
 */
@Entity
@Table(name = "periodoxsalon")
@NamedQueries({
    @NamedQuery(name = "Periodoxsalon.findAll", query = "SELECT p FROM Periodoxsalon p"),
    @NamedQuery(name = "Periodoxsalon.findByNPrdId", query = "SELECT p FROM Periodoxsalon p WHERE p.periodoxsalonPK.nPrdId = :nPrdId"),
    @NamedQuery(name = "Periodoxsalon.findBySlnId", query = "SELECT p FROM Periodoxsalon p WHERE p.periodoxsalonPK.slnId = :slnId"),
    @NamedQuery(name = "Periodoxsalon.findByNDctId", query = "SELECT p FROM Periodoxsalon p WHERE p.periodoxsalonPK.nDctId = :nDctId"),
    @NamedQuery(name = "Periodoxsalon.findByNDcnId", query = "SELECT p FROM Periodoxsalon p WHERE p.periodoxsalonPK.nDcnId = :nDcnId"),
    @NamedQuery(name = "Periodoxsalon.findByVEstado", query = "SELECT p FROM Periodoxsalon p WHERE p.vEstado = :vEstado")})
public class Periodoxsalon implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PeriodoxsalonPK periodoxsalonPK;
    @Size(max = 1)
    @Column(name = "vEstado")
    private String vEstado;
    @JoinColumn(name = "nPrdId", referencedColumnName = "nPrdId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Periodo periodo;
    @JoinColumn(name = "nDcnId", referencedColumnName = "nDcnId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Docente docente;
    @JoinColumns({
        @JoinColumn(name = "nDctId", referencedColumnName = "nDctId", insertable = false, updatable = false),
        @JoinColumn(name = "SlnId", referencedColumnName = "SlnId", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Dictadoxsalon dictadoxsalon;

    public Periodoxsalon() {
    }

    public Periodoxsalon(PeriodoxsalonPK periodoxsalonPK) {
        this.periodoxsalonPK = periodoxsalonPK;
    }

    public Periodoxsalon(int nPrdId, int slnId, int nDctId, int nDcnId) {
        this.periodoxsalonPK = new PeriodoxsalonPK(nPrdId, slnId, nDctId, nDcnId);
    }

    public PeriodoxsalonPK getPeriodoxsalonPK() {
        return periodoxsalonPK;
    }

    public void setPeriodoxsalonPK(PeriodoxsalonPK periodoxsalonPK) {
        this.periodoxsalonPK = periodoxsalonPK;
    }

    public String getVEstado() {
        return vEstado;
    }

    public void setVEstado(String vEstado) {
        this.vEstado = vEstado;
    }

    public Periodo getPeriodo() {
        return periodo;
    }

    public void setPeriodo(Periodo periodo) {
        this.periodo = periodo;
    }

    public Docente getDocente() {
        return docente;
    }

    public void setDocente(Docente docente) {
        this.docente = docente;
    }

    public Dictadoxsalon getDictadoxsalon() {
        return dictadoxsalon;
    }

    public void setDictadoxsalon(Dictadoxsalon dictadoxsalon) {
        this.dictadoxsalon = dictadoxsalon;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (periodoxsalonPK != null ? periodoxsalonPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Periodoxsalon)) {
            return false;
        }
        Periodoxsalon other = (Periodoxsalon) object;
        if ((this.periodoxsalonPK == null && other.periodoxsalonPK != null) || (this.periodoxsalonPK != null && !this.periodoxsalonPK.equals(other.periodoxsalonPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.persistencia.domain.Periodoxsalon[ periodoxsalonPK=" + periodoxsalonPK + " ]";
    }
    
}
